/*
	Tencent is pleased to support the open source community by making PhxSQL available.
	Copyright (C) 2016 THL A29 Limited, a Tencent company. All rights reserved.
	Licensed under the GNU General Public License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
	
	https://opensource.org/licenses/GPL-2.0
	
	Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
*/

#pragma once

#include <stdint.h>
#include <unistd.h>

#define STATISTICS(func) \
	    phxbinlog::PhxBinlogStatFactory::GetPhxBinlogStat()->func;

#define STATISTICS_PAXOS(func) \
	    phxbinlog::PhxBinlogStatFactory::GetPhxBinlogPaxosStat()->func;

namespace phxbinlog {
class PhxBinlogStat;
class PhxBinlogPaxosStat;

class PhxBinlogStatFactory {
 public:
    static PhxBinlogStat * GetPhxBinlogStat();
    static void SetPhxBinlogStat(PhxBinlogStat * phxsql_stat);

    static PhxBinlogPaxosStat * GetPhxBinlogPaxosStat();
    static void SetPhxBinlogPaxosStat(PhxBinlogPaxosStat * phxsql_paxos_stat);
 private:
    static PhxBinlogStat * phxsql_stat_;
    static PhxBinlogPaxosStat * phxsql_paxos_stat_;
};

class PhxBinlogStat {
 public:
    PhxBinlogStat() {
    }
    virtual ~PhxBinlogStat() {
    }

    virtual void MySqlAcceptFail() {
    }
    virtual void MySqlAcceptSucess() {
    }
    virtual void MySqlBinlogSend() {
    }
    virtual void MySqlBinlogSendFail() {
    }
    virtual void MySqlGetLastGTID() {
    }
    virtual void MySqlSendEventTime(const uint32_t &send_time) {
    }
    virtual void GetMasterCall() {
    }
    virtual void MySqlGtidNumDiff(const uint32_t &gtid_num_diff) {
    }
    virtual void MonitorCheckFail() {
    }
    virtual void MasterInitFail() {
    }
    virtual void MasterHeartBeat() {
    }
    virtual void MasterChange() {
    }
    virtual void MasterChangeConflict() {
    }
    virtual void MasterStatErr() {
    }
    virtual void SlaveStatErr() {
    }
    virtual void GtidEventSendFail() {
    }
    virtual void GtidEventMasterConficlt() {
    }
    virtual void GtidEventExit() {
    }
    virtual void GtidEventConflict() {
    }
    virtual void GtidEventCheckSumConflict() {
    }
    virtual void GtidEventExecute() {
    }
    virtual void GtidEventExecuteSucess() {
    }
    virtual void GtidEventExecuteFail() {
    }
    virtual void GtidEventTransferNum(const uint32_t &num) {
    }
    virtual void GtidEventAddEventFail() {
    }
    virtual void GtidEventResetGtidFilePosFail() {
    }
    virtual void GtidEventGetEventFail() {
    }
    virtual void GtidEventSwitchDataFile() {
    }
    virtual void GtidEventFileDataParseFail() {
    }

    virtual void PaxosExecuteTime(const uint32_t &use_time) {
    }
    virtual void PaxosSendTime(const uint32_t &use_time) {
    }
    virtual void ReplMySqlConnectFail() {
    }
    virtual void ReplMasterLogin() {
    }
    virtual void ReplSlaveLogin() {
    }
    virtual void ReplLoginSucess() {
    }
    virtual void ReplLoginFail() {
    }
    virtual void ReplRecvDataFail() {
    }
    virtual void ReplSendDataFail() {
    }
    virtual void ReplGtidParseFail() {
    }
    virtual void ReplCheckSumFail() {
    }
    virtual void MySqlGTIDBroken() {
    }
    virtual void MySqlQueryFail() {
    }
    virtual void MySqlConnectFail() {
    }
    virtual void MasterChangeFail() {
    }
    virtual void CheckPointTransferFile() {
    }
    virtual void CheckPointLoadTransferFile() {
    }
    virtual void CheckPointDeleteCheckPointNum(const uint32_t &num) {
    }
    virtual void CheckPointLoadDataFail() {
    }
    virtual void StorageWriteDataFail() {
    }
    virtual void StorageReadDataFail() {
    }
};

class PhxBinlogPaxosStat {
 public:
    PhxBinlogPaxosStat() {
    }
    virtual ~PhxBinlogPaxosStat() {
    }

 public:
    virtual void * GetPaxosCheckPoint() {
        return NULL;
    }
};

}
